//
//  DKBaseVC.h
//  Whistle
//
//  Created by ZhangAo on 18/01/2018.
//  Copyright © 2018 BookSir. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIViewController (instanceOfAppropriate)

/**
 *  从 xib 或 storyboard 实例化，如果 xib 不存在，则直接通过 new 来实例化
 */
+ (instancetype)instanceOfAppropriate;

+ (NSString *)storyboardName;

@end

////////////////////////////////////////////////////////////////

@interface DKBaseVC : UIViewController

#pragma mark - 导航栏相关

@property (nonatomic, strong, readonly) UINavigationBar *translucentNavigationBar;

// 是否启用侧滑返回，默认为 YES；当子类设置 leftBarButtonItem 时自动禁用。
- (BOOL)enableInteractivePopGestureRecognizer;

// 左侧导航相关
- (void)updateBackBarButtonColor:(UIColor *)color;
- (void)updateBackBarButtonTitle:(NSString *)title;
- (void)updateBackBarButtonAction:(SEL)selector;

- (void)updateNextBackBarButtonTitle:(NSString *)title;

#pragma mark - 3D Touch 相关

@property (nonatomic, assign) BOOL isIn3DTouchPreview;                          // 需要由外部设置，重要
@property (nonatomic, copy) NSArray<id<UIPreviewActionItem>> *previewActions NS_AVAILABLE_IOS(9.0);

@end

////////////////////////////////////////////////////////////////

/**
 *  所有 TableVC 的基类
 */
@interface DKBaseTableVC : UITableViewController

#pragma mark - 导航栏相关

@property (nonatomic, strong, readonly) UINavigationBar *translucentNavigationBar;

// 是否启用侧滑返回，默认为 YES；当子类设置 leftBarButtonItem 时自动禁用。
- (BOOL)enableInteractivePopGestureRecognizer;

// 左侧导航相关
- (void)updateBackBarButtonColor:(UIColor *)color;
- (void)updateBackBarButtonTitle:(NSString *)title;
- (void)updateBackBarButtonAction:(SEL)selector;

- (void)updateNextBackBarButtonTitle:(NSString *)title;

@end

////////////////////////////////////////////////////////////////

/**
 *  对透明导航栏提供支持
 */
@interface UIViewController (TranslucentNavigationBar)

+ (BOOL)enableTranslucentNavigationBar;

- (void)setRightBarButtonItem:(UIBarButtonItem *)item;

- (void)setupBarViewBackColor:(UIColor *)color;

- (void)setupBarViewTitle:(NSString *)title;

- (void)setupBarTitleView:(UIView *)titleView;

@end
